package exercise.exer1;

public class GeometricTest {
    //比较两个几何图形的面积是否相等
    public boolean equalsArea(GeometricObject g1,GeometricObject g2){
        return g1.findArea() == g2.findArea();
    }

    public void displayGeometricObject(GeometricObject g){
        System.out.println("几何图形的面积为："+g.findArea());
    }

    public static void main(String[] args){
        GeometricTest test = new GeometricTest();

        Circle c1 = new Circle("rea",1.0,2.3);
        Circle c2 = new Circle("blue",1.0,3.3);

        test.displayGeometricObject(c1);
        test.displayGeometricObject(c2);

        boolean isEquals = test.equalsArea(c1,c2);
        if(isEquals){
            System.out.println("面积相等");
        }else{
            System.out.println("面积不等");
        }

        //使用匿名对象
        test.displayGeometricObject(new MyRectangle("blue",1.0,3.0,4.0));
    }
}
